import React from 'react';
import { EntityInstance } from 'draft-js';
import SpecialTextWithInput from './SpecialTextWithInput'
//@ts-ignore
const CustomEntityDecorator = React.memo(({ children, contentState, entityKey }) => {
    const entity = contentState.getEntity(entityKey);
    const entityType = entity.getType();

    // 根据您的需求替换为您的实际 Entity 组件
    const CustomEntityComponent = SpecialTextWithInput;


    return (
      <>
        {/* @ts-ignore */}
        <CustomEntityComponent entity={entity} entityType={entityType} />
        {/* {children} */}
      </>
    );
  },
  // 自定义比较函数，仅在必要的属性发生变化时进行更新
  (prevProps, nextProps) => {
    if (
      //@ts-ignore
      prevProps.entityKey === nextProps.entityKey
    ) {
      return true;
    }
    return false;
  }
);

export default CustomEntityDecorator;
